#version 450

layout(location = 0) in vec4 fragColor;
layout(location = 1) flat in vec2 center;
layout(location = 2) flat in float circleRadius;
layout(location = 3) flat in float lineThickness;

layout(location = 0) out vec4 outColor;

void main() {
	float alpha = 1.0;
	float dist = distance(gl_FragCoord.xy, center);
	if (dist > circleRadius)
		discard;
	if (lineThickness > 0.0) {
		float iner = circleRadius - lineThickness;
		if (dist < iner)
			discard;
		alpha = smoothstep(iner, iner + 1.8, dist);
		alpha = min(alpha, 1.0 - smoothstep(circleRadius - 1.8, circleRadius, dist));
	}
	else {
		alpha = 1.0 - smoothstep(circleRadius - 1.8, circleRadius, dist);
	}
	outColor = vec4(fragColor.rgb, fragColor.a * alpha);
}